package com.sumainfor.pc.epc.controller;

import cn.afterturn.easypoi.entity.vo.MapExcelConstants;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.epc.service.impl.RepairExcServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Meng
 * @ClassName RepairExcController
 * @date 2020/2/11 14:26
 * @description: TODO
 */
@Controller
@RequestMapping("/RepairExc")
public class RepairExcController {

    @Autowired
    RepairExcServiceImpl repairExcService;

    /**
     * 维修统计表
     * @param params
     * @param pager
     * @return
     */
    @PostMapping("/getRepairList")
    @ResponseBody
    public JsonResult getRepairList(@RequestBody Map<String,Object> params, Pager pager){

        return repairExcService.getRepairList(params,pager);

    }

    /**
     * 导出维修统计表
     * @param modelMap
     * @param params
     * @return
     * @throws Exception
     */
    @RequestMapping("/exportRepairList")
    public String exportRepairList(ModelMap modelMap, @RequestParam Map<String, Object> params) throws Exception {
        repairExcService.exportRepairList(modelMap, params);
        return MapExcelConstants.EASYPOI_MAP_EXCEL_VIEW;
    }


}
